<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
  <body>
    <script>
    let arr =[0,1,2,5,4,8,0,8,0,8,0,5,6,0]
    let arr2 = []
    for (let i=0;i<arr.length;i++){
      if(arr[i]!==0){
        arr2.push(arr[i])
      }
    }
      
  </script>
</body>
</html>